#search
  - form_tag :action => "show_all" do
    = text_field_tag "q", "",:size=>"40"
    = submit_tag "ค้นหา"

- @posts.each do |post|
  .date
    = link_to post.user.login, {:action=>:show, :user=>post.user.login}
    = date_thai post.created_at, :time=>true
  - if post.post_photo.exists?
    %div{:style=>'text-align:center;'}= image_tag post.post_photo.url
    .body= h(post.body) unless post.body.blank?
  - elsif post.widget
    %div{:style=>'text-align:center;'}= post.widget
  - else
    .post_subject
      = h(post.subject) unless post.subject.blank?
    .body= h(post.body) unless post.body.blank?
  .bar= image_tag "bar.gif"
= will_paginate @posts, :previous_label => '&laquo; หน้าก่อน', :next_label => 'หน้าถัดไป &raquo;'
